﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace KTVProject.frm
{
    public partial class AddSingerInfo : Form
    {
        string tiShi = "提示";

        public AddSingerInfo()
        {
            InitializeComponent();
        }

        private void AddSingerInfo_Load(object sender, EventArgs e)
        {

        }

        private void btnClose_Click(object sender, EventArgs e) //取消按钮
        {
            this.Close();
        }

        private void btnAdd_Click(object sender, EventArgs e)   //添加按钮
        {
            if (CheckInput())
            {

            }
        }

        private bool CheckInput()   //非空验证
        {
            if (txtSingerName.Text.Trim().Equals(string.Empty))
            {
                MessageBox.Show("请输入姓名", tiShi, MessageBoxButtons.OK, MessageBoxIcon.Hand);

                return false;
            }
            else if (rbtnMan.Checked == false && rbtnWomen.Checked == false && rbtnGroup.Checked == false)
            {
                MessageBox.Show("请选择性别", tiShi, MessageBoxButtons.OK, MessageBoxIcon.Hand);

                return false;
            }
            else
            {
                return true;
            }
        }

        private void pictureBoxSinger_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            DialogResult result = openFile.ShowDialog();

            if (result == DialogResult.OK)
            {
                //string name = openFile.SafeFileName;  //获取文件名
                //this.labAddress.Text = "文件路径:" + openFile.FileName;//获取文件名包括路径

                this.pictureBoxSinger.Image = Image.FromFile(openFile.FileName);

                //string urlFile = openFile.FileName;
                int index = openFile.FileName.LastIndexOf("\\");
                string fileName = openFile.FileName.Substring(index + 1);

                //this.labFileName.Text = "文件名称:" + fileName;
            }
        }
    }
}
